<include file="common/header"/>
<script type="text/javascript" src="/javascript/region.js"></script>

<div class="main-container">
    <form name="pay" id="pay" method="POST" action="/cart/check/">
    <div class="container">

            <if condition="($deal_item.is_delivery eq 1)">
                <div class="content pay-item">
                    <h1 class="main-title">确认收货地址</h1>
                    <button class="ui-btn ui-btn-blue ui-btn-mi add-address" id="add-address" data-toggle="modal"
                            data-target="#add_address">+&nbsp;添加新地址
                    </button>
                    <div class="row mt20 form-radio">
                        <div class="table-responsive">
                            <table class="table table-bordered add-setting">
                                <thead>
                                <tr>
                                    <th class="text-center">选择</th>
                                    <th>收货人</th>
                                    <th>所在地区</th>
                                    <th>详细地址</th>
                                    <th>邮编</th>
                                    <th>电话/手机</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="consignee_list" id="vo">
                                    <tr>
                                        <td class="text-center">

                                            <input type="radio" name="consignee_id" value="{$vo.id}"<if condition="($vo['default'] eq 1)">checked</if>>
                                        </td>
                                        <td>{$vo.consignee}</td>
                                        <td>{$vo.province}省{$vo.city}市</td>
                                        <td>{$vo.address}</td>
                                        <td>{$vo.zip}</td>
                                        <td>{$vo.mobile}</td>
                                        <td><a class="ui-btn ui-btn-blue btn-setting-add reset-add " data-id="{$vo.id}">修改地址</a></td>
                                    </tr>
                                </volist>
                                </tbody>
                            </table>
                        </div>

                     </div>
</div>
</if>
<div class="content pay-item mt20 pt10">
    <h1 class="main-title">确认订单信息</h1>

    <input type="hidden" name="id" value="{$deal_item.id}">
    <div class="order-info">
        <h1 class="f18 fb">{$deal_info.name} - {$deal_item.title}</h1>

        <div class="row mb30">
            <label class="col-xs-2">回报内容：</label>

            <div class="col-xs-10">
                {$deal_item.description}
            </div>
        </div>
        <div class="row mb30">
            <label class="col-xs-2">运费：</label>

            <div class="col-xs-10">
                <if condition="($deal_item.is_delivery eq 1)">
                    <if condition="($deal_item.delivery_fee gt 0)">快递费:¥{$deal_item.delivery_fee|round=2}
                        <else/>
                        全国包邮
                    </if>
                    <else/>
                    不需物流
                </if>
            </div>
        </div>
        <div class="row mb30">
            <label class="col-xs-2">预计回报发送时间：</label>

            <div class="col-xs-10">
                项目成功结束后{$deal_item.repaid_day}天
            </div>
        </div>

        <div class="row mb10">
            <div class="col-xs-12">
                <div class="box-textarea">
                    <textarea name="memo" placeholder="给项目发起人留言"></textarea>
                </div>
            </div>
        </div>
        <div class="text-center mb30">
            <span class="fb">总计金额(元）：</span>
            <span class="total-money">{$deal_item.price_format}</span>
        </div>
        <div class="text-center">
            <a class="ui-btn ui-btn-blue btn-order">确认订单并付款<i class="glyphicon glyphicon-chevron-right ml10"></i> </a>
        </div>
        <script>
            var is_delivery = parseInt("<?php echo $deal_item['is_delivery'];?>");
            $(function () {
                $(".btn-order").on('click', function () {
                    if( (is_delivery > 0 && $("[name=consignee_id]").is(":checked")) || is_delivery == 0){
                        $('#pay').submit();
                    }else{
                        alert("请选择收货地址");
                    }
                })
            })
        </script>
    </div>

</div>
</form>
<div class="modal fade" id="add_address" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" id="add_address_dialog">
        <div class="modal-content">
            <a class="ui-btn ui-btn-blue btn-add-close" onclick="window.location.reload()" style="line-height: 35px;"><i class="glyphicon glyphicon-remove"></i></a>
            <h1 class="add-header">添加新地址</h1>

            <div class="add-content">
                <div class="add-content-form">
                    <form class="ui-form" id="set-add">
                        <div class="row">
                            <label class="col-xs-2 col-xs-offset-2">收件人：</label>

                            <div class="col-xs-4">
                                <div class="ipt">
                                    <input type="text" name="consignee">
                                    <input type="hidden" name="type" id="address-type"/>
                                    <input type="hidden" name="id" id="add-id"/>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-xs-2 col-xs-offset-2">手机：</label>

                            <div class="col-xs-4">
                                <div class="ipt">
                                    <input type="text" name="mobile">
                                </div>
                            </div>
                        </div>
                        <div class="row" id="add-dialog">
                            <label class="col-xs-2 col-xs-offset-2">所在地：</label>

                            <div class="ipt col-xs-6">
                                <div class="col-xs-4">
                                    <select class="form-control province-list" name="province">
                                        <option class="items" rel="0">请选择省份</option>
                                        <option class="items" data-val="安徽" rel="3">安徽</option>
                                        <option class="items" data-val="澳门" rel="396">澳门</option>
                                        <option class="items" data-val="北京" rel="52">北京</option>
                                        <option class="items" data-val="重庆" rel="394">重庆</option>
                                        <option class="items" data-val="福建" rel="4">福建</option>
                                        <option class="items" data-val="甘肃" rel="5">甘肃</option>
                                        <option class="items" data-val="广东" rel="6">广东</option>
                                        <option class="items" data-val="广西" rel="7">广西</option>
                                        <option class="items" data-val="贵州" rel="8">贵州</option>
                                        <option class="items" data-val="海南" rel="9">海南</option>
                                        <option class="items" data-val="河北" rel="10">河北</option>
                                        <option class="items" data-val="黑龙江" rel="12">黑龙江</option>
                                        <option class="items" data-val="河南" rel="11">河南</option>
                                        <option class="items" data-val="湖北" rel="13">湖北</option>
                                        <option class="items" data-val="湖南" rel="14">湖南</option>
                                        <option class="items" data-val="江苏" rel="16">江苏</option>
                                        <option class="items" data-val="江西" rel="17">江西</option>
                                        <option class="items" data-val="吉林" rel="15">吉林</option>
                                        <option class="items" data-val="辽宁" rel="18">辽宁</option>
                                        <option class="items" data-val="内蒙古" rel="19">内蒙古</option>
                                        <option class="items" data-val="宁夏" rel="20">宁夏</option>
                                        <option class="items" data-val="青海" rel="21">青海</option>
                                        <option class="items" data-val="山东" rel="22">山东</option>
                                        <option class="items" data-val="上海" rel="321">上海</option>
                                        <option class="items" data-val="山西" rel="23">山西</option>
                                        <option class="items" data-val="陕西" rel="24">陕西</option>
                                        <option class="items" data-val="四川" rel="26">四川</option>
                                        <option class="items" data-val="台湾" rel="397">台湾</option>
                                        <option class="items" data-val="天津" rel="343">天津</option>
                                        <option class="items" data-val="香港" rel="395">香港</option>
                                        <option class="items" data-val="西藏" rel="28">西藏</option>
                                        <option class="items" data-val="新疆" rel="29">新疆</option>
                                        <option class="items" data-val="云南" rel="30">云南</option>
                                        <option class="items" data-val="浙江" rel="31">浙江</option>
                                    </select>
                                </div>
                                <div class="col-xs-4">
                                    <select class="form-control city-list" name="city">
                                        <option class="items" rel="0">请选择城市</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-xs-2 col-xs-offset-2">详细地址：</label>

                            <div class="col-xs-4">
                                <div class="ipt">
                                    <input type="text" name="address">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-xs-2 col-xs-offset-2">邮编：</label>

                            <div class="col-xs-4">
                                <div class="ipt">
                                    <input type="text" name="zip">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="add-link text-center mt30">
                    <a class="ui-btn ui-btn-blue ui-btn-default mr30" id="save-add">保存</a>
                    <a class="ui-btn ui-btn-disabled ui-btn-default" onclick="window.location.reload()">取消</a>
                    <p class="fc-red add_tips f14 mt10"></p>
                </div>
            </div>
        </div>
    </div>
</div>
<!--添加地址end-->
<include file="common/footer"/>